<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <br/>
            <h:form id="userForm" enctype="multipart/form-data">
                <p:growl id="messages" autoUpdate="true"  />

                <h3 class="title">IPTU </h3>

                <hr/>
                <p:panel id="btPanel" styleClass="container_24 clearfix ">

                    <div class="buttonAction">
                        <p:commandButton id="gerarIptuCommandButton"
                                         value="Gerar IPTU"
                                         actionListener="#{managerIPTU.gerarIPTU()}"
                                         update="@form" rendered="#{managerIPTU.possuiIptu}"
                                         style="width: 150px;"
                                         icon="ui-icon-check"/>
                        <p:commandButton value="Gerar IPTU"
                                         oncomplete="dlg.show();"
                                         update="@form" rendered="#{!managerIPTU.possuiIptu}"
                                         style="width: 150px;"
                                         icon="ui-icon-check"/>
                        <p:commandButton title="Imprimir"
                                         ajax="false" value="Imprimir" update="@form"
                                         onclick="this.form.target='_blank'"
                                         style="width: 150px;"
                                         actionListener="#{managerIPTU.geraBoleto()}"
                                         icon="ui-icon-print" />
                        <p:menuitem value="Gerar Iptu"  icon="ui-icon-arrowrefresh-1-w" ajax="false" update="@form"
                                    onclick="this.form.target='_blank'" actionListener="#{managerPesquisarImovel.imprimirBoleto}"/>

                    </div>

                </p:panel>

                <p:blockUI id="block" block="userForm" trigger="gerarIptuCommandButton" > 
                    <p:graphicImage value="media/images/ajax-loader.gif"/>
                </p:blockUI> 

                <p:dialog id="modalDialog" header="IPTU" widgetVar="dlg" modal="true" 
                          height="100" width="400" closable="true" resizable="false" >
                    <h:outputText value="IPTU desse ano já foi gerado deseja gerar novamente?"/>
                    <div class="buttonAction" >
                        <p:commandButton id="gerarIptuDialogCommandButton"
                                         value="Sim" actionListener="#{managerIPTU.gerarIPTU()}"
                                         update="@form" style="width: 153px;"
                                         icon="ui-icon-check" oncomplete="dlg.hide()"/>
                        <p:commandButton value="Não" icon="ui-icon-close" 
                                         oncomplete="dlg.hide()"/>
                    </div>
                    <p:blockUI id="blockDialog" block="modalDialog" trigger="gerarIptuDialogCommandButton" > 
                        <p:graphicImage value="media/images/ajax-loader.gif"/>
                    </p:blockUI> 
                </p:dialog><!--
            </p:panel>-->
            </h:form>
        </ui:define>
    </ui:composition>
</html>
